# Maintainer: Hoang Nguyen <folliekazetani@protonmail.com>
pkgname=undock
pkgver=0.7.0
pkgrel=0
pkgdesc="Tool to extract contents of a container image into a local folder"
url="https://crazymax.dev/undock/"
arch="all"
license="MIT"
makedepends="go linux-headers gpgme-dev btrfs-progs-dev lvm2-dev sqlite-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/crazy-max/undock/archive/refs/tags/v$pkgver.tar.gz"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

_gotags="containers_image_openpgp exclude_graphdriver_btrfs exclude_graphdriver_devicemapper libsqlite3"

build() {
	go build -v -o bin/$pkgname \
		-ldflags "-X main.version=$pkgver" \
		-tags "$_gotags" \
		./cmd
}

check() {
	go test -tags "$_gotags" ./...
}

package() {
	install -Dm755 bin/$pkgname -t "$pkgdir"/usr/bin/
}

sha512sums="
ac3bd91a67445b12ea6c5f9a5e40055a99da1718679fcb670cdd35c47d7bab67dd8fe8563baf922baeb741df9e0a4cd82b4bcfdc2cf2e65c19ed2b848354c18d  undock-0.7.0.tar.gz
"
